home *** CD-ROM | disk | FTP | other *** search
- // copyright 1993 Michael B. Johnson; some portions copyright 1994, MIT
- // see COPYRIGHT for reuse legalities
- //
-
-
- #import "WWDADLightView.h"
-
- @implementation WWDADLightView
-
- - initFrame:(const NXRect *)r
- {
- const char *dragTypes[] = { NXAsciiPboardType, NULL};
-
- [super initFrame:r];
- [self registerForDraggedTypes:dragTypes count:1];
- alpha = 0.0;
- [self setImageFile:"light12Small"];
- return self;
- }
-
- - awake
- {
- const char *dragTypes[] = { NXAsciiPboardType, NULL};
-
-
- [super awake];
- [self registerForDraggedTypes:dragTypes count:1];
- return self;
- }
-
- - free
- {
- const char *fileType[] = { "" };
- Pasteboard *pboard = [Pasteboard newName:NXDragPboard];
-
-
- [pboard declareTypes:fileType num:0 owner:nil];
- [self unregisterDraggedTypes];
- image = nil; // don't free the potentially shared image
-
- return [super free];
- }
-
-
- - setLightType:(N3DLightType)newLightType { lightType = newLightType; return self; }
- - (N3DLightType)lightType { return lightType; }
-
- /*-------------------- methods to be the source of a dragging operation */
-
- - mouseDown:(NXEvent *)theEvent
- {
- NXPoint zero = {0.0, 0.0};
- id thePboard;
- const char *dragTypes[] = { NXAsciiPboardType, NULL};
- static char *fooBarBaz = "fooBarBaz";
-
-
- if (!image) { return self; }
-
- // Prevent default window ordering (this is a new appkit feature)
- [NXApp preventWindowOrdering];
-
- //get the Pboard
- thePboard = [Pasteboard newName:NXDragPboard];
- [thePboard declareTypes:dragTypes num:1 owner:nil];
-
- // we're not really going to use this info, we're just sticking something on the board...
- [thePboard writeType:NXAsciiPboardType data:fooBarBaz length:(1 + strlen(fooBarBaz))];
-
- //start the drag
- [self dragImage:image // visible on screen during drag
- at:&zero // offset the mouse point for the drag
- offset:&zero // offset the inital mouse pt
- event:theEvent // theEvent structure
- pasteboard:thePboard // a Pasteboard with data on it
- source:self // source object
- slideBack:YES]; // if no destination animate back to source
-
- return self;
- }
-
- - draggedImage:(NXImage *)image beganAt:(NXPoint *)screenPoint { return self; }
-
- - (NXDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag { return (NX_DragOperationCopy | NX_DragOperationGeneric); }
-
- - draggedImage:(NXImage *)image endedAt:(NXPoint *)screenPoint deposited:(BOOL)flag { return self; }
-
- @end
-